<%@ include file="/WEB-INF/jsp/include.jsp"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>
    <title><spring:message code="page.title.register"/></title>
    <c:url var="jquery_custom_css" value="/ui/jquery-ui-1.8.4.custom.css" />
    <link href="${jquery_custom_css}" rel="stylesheet" type="text/css" />
    <c:url var="jquery_treeview_css" value="/css/jquery.treeview.css" />
    <link href="${jquery_treeview_css}" rel="stylesheet" type="text/css" />
    <c:url var="housewifes_css" value="/css/housewifes.css" />
    <link href="${housewifes_css}" rel="stylesheet" type="text/css" />

    <c:url var="jquery_js" value="/script/jquery-1.4.2.js" />
    <script type="text/javascript" src="${jquery_js}"></script>
    <c:url var="jquery_cookie_js" value="/script/jquery.cookie.js" />
    <script type="text/javascript" src="${jquery_cookie_js}"></script>
    <c:url var="jquery_treeview_js" value="/script/jquery.treeview.js" />
    <script type="text/javascript" src="${jquery_treeview_js}"></script>
    <c:url var="jquery_custom_js" value="/script/jquery-ui-1.8.4.custom.min.js" />
    <script type="text/javascript" src="${jquery_custom_js}"></script>

    <c:url var="hw_js" value="/script/housewifes.js" />
    <script type="text/javascript" src="${hw_js}"></script>

</head>
<body>

<form action="<c:url value="/register.html"/>" method="post">
<table>
    <tr>
        <td>username</td>
        <td>
            <spring:bind path="user.userName">
                <form:input path="user.userName" />
                <c:out value="${status.errorMessage}"/>
            </spring:bind>
        </td>
    </tr>
    <tr>
        <td>password</td>
        <td>
            <form:input path="user.userPass" />
        </td>
    </tr>
    <tr>
        <td>email</td>
        <td>
            <spring:bind path="user.email">
                <form:input path="user.email" />
                <c:out value="${status.errorMessage}"/>
            </spring:bind>
        </td>
    </tr>
    <tr>
        <td>fullName</td>
        <td>
            <form:input path="user.fullName" />
        </td>
    </tr>
    <tr>
        <td>region</td>
        <td>
            <form:hidden path="user.region.id" id="user_region_id"/>
            <span id="user_region_name_span"><c:out value="${user.region != null ? user.region.name : ''}"/></span>
            <span class="dialog_link dialog_link_region">select</span>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="submit" value="OK">
        </td>
    </tr>
</table>
</form>

<div id="regions_select_dialog" style="display:none;">
    <div id="regions_select_dialog_1">
        loading regions...
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function() {

        var regsd = new RegionsSelectDialog("regions_select_dialog", "<c:url value="/get-select-region-form.html"/>");

        $(".dialog_link_region").click(function(){
            regsd.onRegionDialogLinkClick(function(regionId, regionName) {
                $("#user_region_id").val(regionId);
//                $("#user_region_name").val(regionName);
                $("#user_region_name_span").html(regionName);
            });
        });

    });
</script>

</body>
</html>